< previous page page_884 next page >

Page 884
Type.gifListing A.12. Coding the SQLFileOpen routine.
Sub SQLFileOpen(strSQLFile As String)
    '
    ' open the SQV script file
    '
    On Error GoTo SQLFileOpenErr
    '
    If Len(Trim(strSQLFile)) = 0 Then
       SQLVBMain.CommonDialog1.DialogTitle = "Load SQLVB File"
       SQLVBMain.CommonDialog1.DefaultExt = "SQV"
       SQLVBMain.CommonDialog1.Filter = "SQLVB File|*.SQV"
       SQLVBMain.CommonDialog1.ShowOpen
       strSQLFile = SQLVBMain.CommonDialog1.filename
    End If
    '
    If Len(Trim(strSQLFile)) = 0 Then
       intGlobalErr = True
       intSQLFlag = False
       GoTo SQLFileOpenExit
    End If
    '
    intSQLFileHandle = FreeFile(0)
    Open strSQLFile For Input As intSQLFileHandle
    intGlobalErr = False
    intSQLFlag = True
    GoTo SQLFileOpenExit
    '
SQLFileOpenErr:
    If Err <> 32755 Then
        ErrMsg Err, Error$, intLine, strSQLFile, "SQLFileOpen"
    End If
    InitApp
    intGlobalErr = True
    '
SQLFileOpenExit:
    '
End Sub
Creating SQLFileClose
Let's skip over the SQLProcess routine and write the SQLFileClose routine next. The only task this routine has to complete is to safely close the script file upon completion. Create a Public Sub procedure called SQLFileClose and enter the code in Listing A.13.
Type.gifListing A.13. Coding the SQLFileClose routine.
Sub SQLFileClose()
    '
    ' close the SQV text file

 
< previous page page_884 next page >

If you like this book, buy it!